<template>
    <div class="Avie-steps">
        <div class="steps">
            <div :class="`step ${active >= i ? 'is-success' : ''}`" v-for="(item, i) in data" :key="i">
                <div :class="`step-content`">
                    <span class="step-number" v-if="active <=i">{{ i + 1 }}</span>
                    <icon-svg icon-class="success" class="step-number" v-else />
                    <span>{{ item }}</span>
                </div>
                <div class="step__arrow" v-if="i !== data.length - 1">
                    <icon-svg icon-class="fly" class="svg-fly" />
                </div>
            </div>
        </div>
        <div class="Avie-steps-content">
            <slot>
            </slot>
        </div>
        <div class="Avie-steps-footer">
            <button class="Avie_btn_confirm">保存</button>
            <el-button size="small">取消</el-button>
        </div>
    </div>
</template>

<script>
export default {
    props: {
        data: {
            type: Array,
            default: ()=>[]
        },
        active: {
            default: 0,
            type: Number
        }
    }
};
</script>

<style lang="scss" scoped>
.Avie-steps{
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    .steps {
        width: 700px;
        margin: 0 auto;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 13px 0;
        .step {
            &:not(:last-child) {
                flex-basis: 50%;
                margin-right: 0px;
            }
            &:last-of-type {
                flex-basis: auto !important;
                flex-shrink: 0;
            }
            display: flex;

            color: #c1c1c1;
            font-size: 16px;
            &.is-success {
                color: #134ca3;
                .step-number {
                    background-color: #134ca3;
                }
                .step__arrow {
                    &::before,
                    &::after {
                        border-bottom: 3px solid #134ca3;
                    }
                }
            }
            &-number {
                width: 30px;
                height: 30px;
                border-radius: 50%;
                color: #fff;
                background-color: #c1c1c1;
                display: inline-block;
                line-height: 30px;
                text-align: center;
                margin: 0 10px;
            }
            &-content {
                align-items: center;
                display: flex;
            }
            &__arrow {
                flex: 1;
                padding: 0 20px;
                display: flex;
                justify-items: center;
                // justify-content: center;
                align-items: center;
                &::before,
                &::after {
                    content: '';
                    flex: 1;
                    border-bottom: 3px dashed #ddd;
                }
                .svg-fly {
                    width: 26px;
                    height: 26px;
                    margin: 0 13px;
                    // color:red
                }
            }
        }
        .svg-container {
            line-height: 26px;
            height: 26px;
            display: inline-block;
            margin: 0 13px;
        }
    }
    .Avie-steps-content{
        flex: 1;
    }
}
</style>
